namespace ASPNET.StarterKit.IssueTracker.BusinessLogicLayer
{
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Configuration;
    using System.Web;

    public class Globals
    {
        public const string IssueColumns = "issuecolumns";
        public const string MobileUserRoles = "mobileuserroles";
        public const string SkipProjectIntro = "skipprojectintro";
        public const string UserRoles = "userroles";

        public static string DataAccessType
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["DataAccessType"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("DataAccessType configuration is missing from you web.config. It should contain  <appSettings><add key=\"DataAccessType\" value=\"data access type\" /></appSettings> ");
                }
                return str;
            }
        }

        public static string DefaultRoleForNewUser
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["DefaultRoleForNewUser"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("DefaultRoleForNewUser configuration is missing from you web.config. It should contain  <appSettings><add key=\"DefaultRoleForNewUser\" value=\"Normal\" /></appSettings> ");
                }
                return str;
            }
        }

        public static string DesktopDefaultUrl
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["DesktopDefaultUrl"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("DesktopDefaultUrl configuration is missing from you web.config. It should contain  <appSettings><add key=\"DesktopDefaultUrl\" value=\"http:\\\\www.YourWebSite.com\\IssueTracker\" /></appSettings> ");
                }
                return str;
            }
        }

        public static bool IsMobileDevice
        {
            get
            {
                HttpContext context = HttpContext.Current;
                return ((StringType.StrCmp(context.Request.Browser["IsMobileDevice"], "true", false) == 0) | (StringType.StrCmp(context.Request.Browser.Platform, "WinCE", false) == 0));
            }
        }

        public static string MobileDefaultUrl
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["MobileDefaultUrl"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("MobileDefaultUrl configuration is missing from you web.config. It should contain  <appSettings><add key=\"MobileDefaultUrl\" value=\"http\\\\www.YourWebSite.com\\MobileIssueTracker\" /></appSettings> ");
                }
                return str;
            }
        }

        public static string NotifyEmail
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["NotifyEmail"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("NotifyEmail configuration is missing from you web.config. It should contain  <appSettings><add key=\"NotifyEmail\" value=\"notify\" /></appSettings> ");
                }
                return str;
            }
        }

        public static string SmtpServer
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["SmtpServer"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("SmtpServer configuration is missing from you web.config. It should contain  <appSettings><add key=\"SmtpServer\" value=\"localhost\" /></appSettings> ");
                }
                return str;
            }
        }

        public static string UserAccountSource
        {
            get
            {
                string str = ConfigurationSettings.AppSettings["UserAccountSource"];
                if ((str == null) || (StringType.StrCmp(str, string.Empty, false) == 0))
                {
                    throw new ApplicationException("UserAccountSource configuration is missing from you web.config. It should contain  <appSettings><add key=\"UserAccountSource\" value=\"account source type\" /></appSettings> ");
                }
                return str;
            }
        }
    }
}

